from mrjob.job import MRJob
from mrjob.protocol import TextProtocol


class BehaviorClassify(MRJob):

    OUTPUT_PROTOCOL = TextProtocol

    def mapper(self, _, line):
        lineinfo = line.strip().split(',')
        if len(lineinfo) == 6:
            if lineinfo[3] == 'fav':
                yield ','.join(lineinfo), 1


    def reducer(self, key, values):
        yield key, None


if __name__ == '__main__':
    BehaviorClassify.run()


